package cn.edu.ldu.protocol;

import cn.edu.ldu.entity.ChatHistoryEntity;
import cn.edu.ldu.util.L;
import cn.edu.ldu.views.controller.MainUIController;
import com.alibaba.fastjson.JSONObject;

public class ChatWithFriend {
    public ChatWithFriend(Protocol protocol){

        ChatHistoryEntity chat = JSONObject.parseObject(protocol.getData(), ChatHistoryEntity.class);
        L.OK(chat, ChatWithFriend.class);
        if (chat.getIsGroup().equals(0)){
            MainUIController.getMainUI().receiveMsg(chat);
        }else {
            MainUIController.getMainUI().receiveGroupMsg(chat);
        }
    }
}
